
<!DOCTYPE html>
<html>

<head>
   
    
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<!--360浏览器优先以webkit内核解析-->


<title>我的出差申请</title>

<link rel="shortcut icon" href="__STATIC__/layout/favicon.ico">
<link href="__STATIC__/layout/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
<link href="__STATIC__/layout/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
<link href="__STATIC__/layout/css/animate.css" rel="stylesheet">
<link href="__STATIC__/layout/css/style.css?v=4.1.0" rel="stylesheet">
<link href="__STATIC__/layout/css/channel.css?v=4.1.0" rel="stylesheet">
<!-- Sweet Alert -->
<link href="__STATIC__/layout/css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
    <link rel="stylesheet" href="__STATIC__/layout/css/demo.css" type="text/css">
    <link href="__STATIC__/layout/css/gyq.css" rel="stylesheet">
  <script src="__STATIC__/layout/js/jquery.min.js?v=2.1.4"></script>
    <script src="__STATIC__/sc/js/page.js"></script> 

</head>

<body class="white-bg" style="padding: 3px;font-size: 13px">
    <div class="page-heade">
       <h2 class="title_color text-center">我的出差申请</h2>
    </div>
   <form action="#" id="f1" class="form-inline formpage" method="post">
      <input type="hidden" value='{$page}' name="page" id="page-go"/>
                      <input type="hidden" value='{$list}' name="list" id="list-go"/>
        <table class="table table-bordered bud_hei">
           
            <tr>
                <td style="width: 120px" class="text-right" >编号：</td>
                <td>
                    <input type="text" name="no" value="{$data.no}" class="form-control">
                </td> 
                   <td style="width: 120px" class="text-right">主题：</td>
                   <td><input type="text" name="title" value="{$data.title}" class="form-control"></td>
                     <td style="width: 120px" class="text-right">类型：</td>
                   <td>
                       <select class="form-control select" name="ttype">
                           <option value="0">请选择</option>
                            <option value="1" {if $data.ttype==1} selected {/if}>周边行程</option>
                            <option value="2" {if $data.ttype==2} selected {/if}>出差申请</option>
                       </select>
                   </td>
               </tr>
               <tr>
                   <td class="text-right">职务代理人：</td>
                   <td><input type="text" name="daili" value="{$data.daili}" class="form-control"></td>
                   <td class="text-right">状态：</td>
                    <td>
                       <select name="st" class="form-control select">
                            <option value="0">请选择</option>
                        {volist name="state" id="s"}
                            {if $s.id==$data.st}
                            <option value="{$s.id}" selected>{$s.title}</option>
                            {else/}
                            <option value="{$s.id}">{$s.title}</option>
                            {/if}
                        {/volist}
                       </select>
                   </td>
                   <td class="text-right">申请时间</td>
                   <td>   <div class="form-group">
            <input type="text" id="start" class="form-control layer-date " style="min-width:120px;width:120px;display: inline-block;" name="start" value="{$data.start}">
           </div>
            <div class="form-group">
                至
            </div>
           <div class="form-group">
            <input type="text" class="form-control layer-date" style="min-width:120px;width:120px;display: inline-block;" id="end" name="end" value="{$data.end}">
           </div></td>
               </tr>
               <tr>
                   <td colspan="6" class="text-center">
                       <button class="btn-sm btn-info btn" type="button" id="check">查询</button><span class="lr_5"></span><button class="btn-sm btn-info btn" type="button" id="clear_check">清空查询条件</button>  
                   </td>
               </tr>
        </table>
    </form>
    <table class="table table-striped table-bordered table-hover bud_hei text-center aprovalSystemTable" style="width: 100%;">
        <tr class="info">
            <th class="text-center">No.</th>
            <th class="text-center">编号</th>
            <th class="text-center" style="width: 300px">主题</th>
            <th class="text-center">类型</th>
            <th class="text-center">职务代理人</th>
            <th class="text-center">状态</th>
            <th class="text-center">申请时间</th>
            <th class="text-center">操作</th>
        </tr>
        <tbody>
        {volist name="apply" id="vo"}
            <tr>
                <td>{$i}</td>
                <td><a class="J_menuItem detail" title="{$vo.no}" href="{:url('detail')}?aid={$vo.id}">{$vo.no}</a></td>
                <td class="text-left">{if $vo.state==7}<b>{/if} {$vo.title} {if $vo.state==7}</b><span class="glyphicon glyphicon-ok duigou" title="已生效" aria-hidden="true"></span>{/if}</td>
                <td>{if $vo.traveltype==1}周边行程{else/}出差申请{/if}</td>
                <td>{if $vo.em_name}{$vo.em_name}{else/}无{/if}</td>
                <td>{$vo.statename}</td>
                <td>{$vo.ctime}</td>
                <td>
                    {if $vo.state==1}
                    
                    {else/}
                     <a href="{:url('Workflowdb/workflowchart',['id'=>$vo.myId])}" class="J_menuItem" title="查看流程图">查看流程图</a>
                    {/if}
                </td>
            </tr>
        {/volist}
    </tbody>
    </table>
   <h5 class="text-center" id="pagesc" style="font-size: 16px;font-weight: 500">
            <script>
                            $(function(){
                                pageSC("pagesc",{$sum},{$page},{$maxpage})
                            })
                        </script>
                        每页显示
           <select id="pagesize">
                        <option value='10' {if condition="$list eq 10"}selected{/if}>10条</option>
                        <option value='20'{if condition="$list eq 20"}selected{/if}>20条</option>
                        <option value='40'{if condition="$list eq 40"}selected{/if}>40条</option>

            </select>
        </h5>

<!-- 全局js -->
<script src="__STATIC__/layout/js/contabs_sub.js"></script>
<script src="__STATIC__/layout/js/bootstrap.min.js?v=3.3.6"></script>
<!-- Sweet alert -->
<script src="__STATIC__/layout/js/plugins/sweetalert/sweetalert.min.js"></script>
 <script src="__STATIC__/layout/js/plugins/layer/laydate/laydate.js"></script>
  <script src="__STATIC__/layout/js/contabs_sub.js"></script>
<script>
//删除
function shanchu(id){
     swal({
      title: "您确定嘛?",
      text: "删除后将不能恢复，请确认",
      type: "warning",
      showCancelButton: true,
      confirmButtonColor: "#DD6B55",
      confirmButtonText: "确定",
      cancelButtonText: "取消",
      closeOnConfirm: false
    },
    function(){
      $.post("{:url('shanchu')}",{id:id},function(re){
            if(re==1){

                        swal({
                                title: "完成",
                                text: "操作已成功",
                                type: "success"
                                },function(){
                                  location.href="{:url('mychuchai')}"
                                  //
                                });
               
                
            }else{
                 swal({
                                title: "错误",
                                text: "系统繁忙请稍后再试",
                                type: "warning"
                                });
            }
      })
    });
}
//提交工作流
function tijiao(id){
    swal({
      title: "您确定嘛?",
      text: "提交后将不能撤销，请核对完相关内容",
      type: "warning",
      showCancelButton: true,
      confirmButtonColor: "#DD6B55",
      confirmButtonText: "确定",
      cancelButtonText: "取消",
      closeOnConfirm: false
    },
    function(){
      $.post("{:url('tijiao')}",{id:id},function(re){
            if(re==1){

                        swal({
                                title: "完成",
                                text: "操作已成功",
                                type: "success"
                                },function(){
                                   document.getElementById("f1").submit();
                                  //
                                });
               
                
            }else{
                 swal({
                                title: "错误",
                                text: "系统繁忙请稍后再试",
                                type: "warning"
                                });
            }
      })
    });
}
    //翻页
   
        $("#check").click(function(){
              $("#page-go").val(1);
              $(".formpage").submit();
        })
        $("#clear_check").click(function(){
            $("input[type='text']").val("");
            $("select").val(0);
            $("#page-go").val(1);
           $(".formpage").submit();
        })
    $(function () {
        $('body').on('click','input[type=text]',function () {
            this.select()
        })
    })
</script>
<script src="__STATIC__/layout/js/plugins/layer/layer.min.js"></script>
<script>
     //日期范围限制
        var start = {
            elem: '#start',
            format: 'YYYY-MM-DD',
            //min: laydate.now(), //设定最小日期为当前日期
            max: '2099-06-16 23:59:59', //最大日期
            istime: true,
            istoday: false,
            choose: function (datas) {
                end.min = datas; //开始日选好后，重置结束日的最小日期
                end.start = datas //将结束日的初始值设定为开始日
            }
        };
        var end = {
            elem: '#end',
            format: 'YYYY-MM-DD',
            //min: laydate.now(),
            max: '2099-06-16 23:59:59',
            istime: true,
            istoday: false,
            choose: function (datas) {
                start.max = datas; //结束日选好后，重置开始日的最大日期
            }
        };
        laydate(start);
        laydate(end);
        function xiugai(id){
               layer.open({
                type: 2,
                title: '修改出差申请',
                 area: ['90%', '90%'],
                fixed: false, //不固定
                maxmin: true,
                content: "{:url('add')}?aid="+id
            });
        }
         function fankui(id){
               layer.open({
                type: 2,
                title: '反馈出差申请',
                 area: ['90%', '90%'],
                fixed: false, //不固定
                maxmin: true,
                content: "{:url('fankui')}?aid="+id
            });
        }
    $(document).ready(function () {
        $("#add_travel_apply").click(function(){
             layer.open({
                type: 2,
                title: '新增出差申请',
                 area: ['90%', '90%'],
                fixed: false, //不固定
                maxmin: true,
                content: "{:url('add')}"
            });
            return false
        })
        

        $('#reset').on('click',function () {
            $("#form1 input").each(function(){
                $(this).val('');
            });
            $("#form1 select").each(function(){
                $(this).val('');
            });
            $('#form1').submit()
            return false
        })
    })   

</script>
<script>
    $(".detail").click(menuItem);
    function menuItem() {
    // 获取标识数据
    var dataUrl = $(this).attr('href'),
        dataIndex = $(this).data('index'),
        menuName = $.trim($(this).attr("title")),
        flag = true;
    if (dataUrl == undefined || $.trim(dataUrl).length == 0)return false;

    // 选项卡菜单已存在
    top.$('.J_menuTab').each(function () {
        if ($(this).data('id') == dataUrl) {
            if (!$(this).hasClass('active')) {
                $(this).addClass('active').siblings('.J_menuTab').removeClass('active');
                scrollToTab(this);
                // 显示tab对应的内容区
                top.$('.J_mainContent .J_iframe').each(function () {
                    if (top.$(this).data('id') == dataUrl) {
                        top.$(this).show().siblings('.J_iframe').hide();
                        return false;
                    }
                });
            }
            flag = false;
            return false;
        }
    });

    // 选项卡菜单不存在
    if (flag) {
        var str = '<a href="javascript:;" class="active J_menuTab" data-id="' + dataUrl + '">' + menuName + ' <i class="fa fa-times-circle"></i></a>';
        top.$('.J_menuTab').removeClass('active');

        // 添加选项卡对应的iframe
        var str1 = '<iframe class="J_iframe" name="iframe' + dataIndex + '" width="100%" height="100%" src="' + dataUrl + '" frameborder="0" data-id="' + dataUrl + '" seamless></iframe>';
        top.$('.J_mainContent').find('iframe.J_iframe').hide().parents('.J_mainContent').append(str1);

        //显示loading提示
//            var loading = layer.load();
//
//            $('.J_mainContent iframe:visible').load(function () {
//                //iframe加载完成后隐藏loading提示
//                layer.close(loading);
//            });
        // 添加选项卡
        top.$('.J_menuTabs .page-tabs-content').append(str);
        scrollToTab(top.$('.J_menuTab.active'));
    }
    return false;
}
//滚动到指定选项卡
function scrollToTab(element) {
    var marginLeftVal = calSumWidth(top.$(element).prevAll()), marginRightVal = calSumWidth(top.$(element).nextAll());
    // 可视区域非tab宽度
    var tabOuterWidth = calSumWidth(top.$(".content-tabs").children().not(".J_menuTabs"));
    //可视区域tab宽度
    var visibleWidth = top.$(".content-tabs").outerWidth(true) - tabOuterWidth;
    //实际滚动宽度
    var scrollVal = 0;
    if (top.$(".page-tabs-content").outerWidth() < visibleWidth) {
        scrollVal = 0;
    } else if (marginRightVal <= (visibleWidth - top.$(element).outerWidth(true) - top.$(element).next().outerWidth(true))) {
        if ((visibleWidth - top.$(element).next().outerWidth(true)) > marginRightVal) {
            scrollVal = marginLeftVal;
            var tabElement = element;
            while ((scrollVal - top.$(tabElement).outerWidth()) > (top.$(".page-tabs-content").outerWidth() - visibleWidth)) {
                scrollVal -= top.$(tabElement).prev().outerWidth();
                tabElement = top.$(tabElement).prev();
            }
        }
    } else if (marginLeftVal > (visibleWidth - top.$(element).outerWidth(true) - top.$(element).prev().outerWidth(true))) {
        scrollVal = marginLeftVal - top.$(element).prev().outerWidth(true);
    }
    top.$('.page-tabs-content').animate({
        marginLeft: 0 - scrollVal + 'px'
    }, "fast");
}
//计算元素集合的总宽度
function calSumWidth(elements) {
    var width = 0;
    top.$(elements).each(function () {
        width += top.$(this).outerWidth(true);
    });
    return width;
}


    </script>
</body>

</html>